﻿using HardcoreGame.Common.CustomSets;
using HardcoreGame.Common.Helpers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace HardcoreGame.Content.Items.Weapons.Sets.Acid
{
    public class ErosionTide : ModItem
    {
        public static Lazy<Asset<Texture2D>> glowmask;
        public override void Unload()
        {
            glowmask = null;
        }
        public override void SetStaticDefaults()
        {
            CustomItemSets.AcidWeapon[Type] = true;
        }
        public override void SetDefaults()
        {
            Item.damage = 15;
            Item.DamageType = DamageClass.Magic;
            Item.width = 58;
            Item.height = 18;
            Item.useAnimation = 16;
            Item.useTime = 8;
            Item.mana = 5;
            Item.useStyle = ItemUseStyleID.Shoot;
            Item.noMelee = true;
            Item.knockBack = 6;
            Item.value = 50000;
            Item.rare = ItemRarityID.Blue;
            Item.UseSound = SoundID.Item13;
            Item.autoReuse = true;
            Item.shoot = ModContent.ProjectileType<Projectiles.Sets.Acid.ErosionTide>();
            Item.shootSpeed = 13.5f;
            if (!Main.dedServ)
            {
                glowmask = new Lazy<Asset<Texture2D>>(() => ModContent.Request<Texture2D>(Texture + "_Glow", (AssetRequestMode)2));
            }
        }
        public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
        {
            MyUtils.BasicInWorldGlowmask(Item, spriteBatch, (Texture2D)glowmask.Value, Color.White, rotation, scale);
        }
    }
}
